home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / sun / management / GcInfoBuilder.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  3.3 KB  |  146 lines

  1. package sun.management;
  2.  
  3. import com.sun.management.GcInfo;
  4. import java.lang.management.GarbageCollectorMXBean;
  5. import java.lang.management.MemoryUsage;
  6. import javax.management.openmbean.CompositeType;
  7. import javax.management.openmbean.OpenDataException;
  8. import javax.management.openmbean.OpenType;
  9. import javax.management.openmbean.SimpleType;
  10.  
  11. public class GcInfoBuilder {
  12.    // $FF: renamed from: gc java.lang.management.GarbageCollectorMXBean
  13.    private final GarbageCollectorMXBean field_0;
  14.    private final String[] poolNames;
  15.    private String[] allItemNames;
  16.    private CompositeType gcInfoCompositeType;
  17.    private final int gcExtItemCount;
  18.    private final String[] gcExtItemNames;
  19.    private final String[] gcExtItemDescs;
  20.    private final char[] gcExtItemTypes;
  21.  
  22.    GcInfoBuilder(GarbageCollectorMXBean var1, String[] var2) {
  23.       this.field_0 = var1;
  24.       this.poolNames = var2;
  25.       this.gcExtItemCount = this.getNumGcExtAttributes(var1);
  26.       this.gcExtItemNames = new String[this.gcExtItemCount];
  27.       this.gcExtItemDescs = new String[this.gcExtItemCount];
  28.       this.gcExtItemTypes = new char[this.gcExtItemCount];
  29.       this.fillGcAttributeInfo(var1, this.gcExtItemCount, this.gcExtItemNames, this.gcExtItemTypes, this.gcExtItemDescs);
  30.       this.gcInfoCompositeType = null;
  31.    }
  32.  
  33.    GcInfo getLastGcInfo() {
  34.       MemoryUsage[] var1 = new MemoryUsage[this.poolNames.length];
  35.       MemoryUsage[] var2 = new MemoryUsage[this.poolNames.length];
  36.       Object[] var3 = new Object[this.gcExtItemCount];
  37.       return this.getLastGcInfo0(this.field_0, this.gcExtItemCount, var3, this.gcExtItemTypes, var1, var2);
  38.    }
  39.  
  40.    public String[] getPoolNames() {
  41.       return this.poolNames;
  42.    }
  43.  
  44.    int getGcExtItemCount() {
  45.       return this.gcExtItemCount;
  46.    }
  47.  
  48.    synchronized CompositeType getGcInfoCompositeType() {
  49.       if (this.gcInfoCompositeType != null) {
  50.          return this.gcInfoCompositeType;
  51.       } else {
  52.          String[] var1 = GcInfoCompositeData.getBaseGcInfoItemNames();
  53.          OpenType[] var2 = GcInfoCompositeData.getBaseGcInfoItemTypes();
  54.          int var3 = var1.length;
  55.          int var4 = var3 + this.gcExtItemCount;
  56.          this.allItemNames = new String[var4];
  57.          String[] var5 = new String[var4];
  58.          OpenType[] var6 = new OpenType[var4];
  59.          System.arraycopy(var1, 0, this.allItemNames, 0, var3);
  60.          System.arraycopy(var1, 0, var5, 0, var3);
  61.          System.arraycopy(var2, 0, var6, 0, var3);
  62.          if (this.gcExtItemCount > 0) {
  63.             this.fillGcAttributeInfo(this.field_0, this.gcExtItemCount, this.gcExtItemNames, this.gcExtItemTypes, this.gcExtItemDescs);
  64.             System.arraycopy(this.gcExtItemNames, 0, this.allItemNames, var3, this.gcExtItemCount);
  65.             System.arraycopy(this.gcExtItemDescs, 0, var5, var3, this.gcExtItemCount);
  66.             int var7 = var3;
  67.  
  68.             for(int var8 = 0; var8 < this.gcExtItemCount; ++var8) {
  69.                switch (this.gcExtItemTypes[var8]) {
  70.                   case 'B':
  71.                      var6[var7] = SimpleType.BYTE;
  72.                      break;
  73.                   case 'C':
  74.                      var6[var7] = SimpleType.CHARACTER;
  75.                      break;
  76.                   case 'D':
  77.                      var6[var7] = SimpleType.DOUBLE;
  78.                      break;
  79.                   case 'E':
  80.                   case 'G':
  81.                   case 'H':
  82.                   case 'K':
  83.                   case 'L':
  84.                   case 'M':
  85.                   case 'N':
  86.                   case 'O':
  87.                   case 'P':
  88.                   case 'Q':
  89.                   case 'R':
  90.                   case 'T':
  91.                   case 'U':
  92.                   case 'V':
  93.                   case 'W':
  94.                   case 'X':
  95.                   case 'Y':
  96.                   default:
  97.                      throw new InternalError("Unsupported type [" + this.gcExtItemTypes[var7] + "]");
  98.                   case 'F':
  99.                      var6[var7] = SimpleType.FLOAT;
  100.                      break;
  101.                   case 'I':
  102.                      var6[var7] = SimpleType.INTEGER;
  103.                      break;
  104.                   case 'J':
  105.                      var6[var7] = SimpleType.LONG;
  106.                      break;
  107.                   case 'S':
  108.                      var6[var7] = SimpleType.SHORT;
  109.                      break;
  110.                   case 'Z':
  111.                      var6[var7] = SimpleType.BOOLEAN;
  112.                }
  113.  
  114.                ++var7;
  115.             }
  116.          }
  117.  
  118.          Object var10 = null;
  119.  
  120.          try {
  121.             String var12 = "sun.management." + this.field_0.getName() + ".GcInfoCompositeType";
  122.             var11 = new CompositeType(var12, "CompositeType for GC info for " + this.field_0.getName(), this.allItemNames, var5, var6);
  123.          } catch (OpenDataException var9) {
  124.             throw Util.newException(var9);
  125.          }
  126.  
  127.          this.gcInfoCompositeType = var11;
  128.          return this.gcInfoCompositeType;
  129.       }
  130.    }
  131.  
  132.    synchronized String[] getItemNames() {
  133.       if (this.allItemNames == null) {
  134.          this.getGcInfoCompositeType();
  135.       }
  136.  
  137.       return this.allItemNames;
  138.    }
  139.  
  140.    private native int getNumGcExtAttributes(GarbageCollectorMXBean var1);
  141.  
  142.    private native void fillGcAttributeInfo(GarbageCollectorMXBean var1, int var2, String[] var3, char[] var4, String[] var5);
  143.  
  144.    private native GcInfo getLastGcInfo0(GarbageCollectorMXBean var1, int var2, Object[] var3, char[] var4, MemoryUsage[] var5, MemoryUsage[] var6);
  145. }
  146.